<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
require_once 'includes/connect.php';
require_once 'includes/function.php';

$task = $_REQUEST["task"];
$card_id = $_REQUEST["card_id"];
$account_name = $_REQUEST["account_name"];
$account_no = $_REQUEST["account_no"];
$bank_id = $_REQUEST["bank_id"];
$branch_id = $_REQUEST["branch_id"];
$bank_type = $_REQUEST["bank_type"];
$payment_method = $_REQUEST["payment_method"];

$db = NEW myDBS();

switch ($task) {
    case "new":

        if ($payment_method == "trans") {

            $sql = "INSERT INTO tbl_payment (card_id, payment_method, account_name, account_no, bank_id, branch_id, bank_type) "
                    . " VALUES ('$card_id', '$payment_method', '$account_name', '$account_no', '$bank_id', '$branch_id', '$bank_type')";
        } else {
            $sql = "INSERT INTO tbl_payment (card_id, payment_method) "
                    . " VALUES ('$card_id', '$payment_method')";
        }
        //echo $sql;
        $db->runSQL($sql) or die(mysql_error());
        break;

    case "edit":
        break;

    default:
        break;
}
?>

